$import( "SmitearWebGL.Objects.Parser.Collada.DaeEntity" );
$import( "SmitearWebGL.Objects.Parser.Collada.DaeAsset" );

SmitearWebGL.Objects.Parser.Collada.DaeMaterial = SmitearWebGL.Objects.Parser.Collada.DaeEntity.extend(
{
	/******** constructor ********/

	init : function( document, node )
	{
		this.effect = "";

		this._super( document, node );
		this._registClass( "SmitearWebGL.Objects.Parser.Collada.DaeMaterial" );
	}
	,
	read : function( node )
	{
		this._super( node );

		$LOG( "reading material: " + this.id  );

		var assetNode = this.getNode( node, SmitearWebGL.Objects.Parser.Collada.Const.DAE_ASSET_ELEMENT );

		if( assetNode )
		this.asset = new SmitearWebGL.Objects.Parser.Collada.DaeAsset( this.document, assetNode );

		// get the one instance_effect
		var effectRef = this.getNode( node, SmitearWebGL.Objects.Parser.Collada.Const.DAE_INSTANCE_EFFECT_ELEMENT );
		this.effect = this.getAttribute( effectRef, SmitearWebGL.Objects.Parser.Collada.Const.DAE_URL_ATTRIBUTE );

		$LOG( " => effect url: " + this.effect );
	}
}
);